package nix.ajax.web.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class BServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		// 设置XML的Content-Type响应头
		response.setContentType("text/xml;charset=utf-8");

		String xml = "<students>" + "<student number='1001'>"
				+ "<name>张三</name>" + "<age>18</age>" + "<gender>F</gender>"
				+ "</student>" + "</students>";
		response.getWriter().print(xml);
	}

}
